﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Dynamic;
using Newtonsoft.Json;

namespace Ecobee.Net
{
	/// <summary>
	/// The SelectionType defines the type of selection to perform. The selectionMatch specifies 
	/// the matching criteria for the type specified.
	/// </summary>
	public enum SelectionType
	{
		/// <summary>
		/// 
		/// </summary>
		None,
		/// <summary>
		/// When this is set the thermostats registered to the current user will be returned. This is only 
		/// usable with Smart thermostats registered to a user. It does not work on EMS thermostats and 
		/// may not be used by a Utility who is not the owner of thermostats. Match is not used.
		/// </summary>
		Registered,
		/// <summary>
		/// Select only those thermostats listed in the match criteria. No spaces in the CSV string. There 
		/// is a limit of 25 identifiers per request.
		/// </summary>
		Thermostats,
		/// <summary>
		/// 
		/// </summary>
		User,
		/// <summary>
		/// Selects all thermostats for a given management set defined by the Management/Utility account. This 
		/// is only available to Management/Utility accounts. "/" is the root, represented by the "My Sets" set.
		/// </summary>
		ManagementSet
	}

	public class Selection : ApiObject
	{
		/// <summary>
		/// Required. The type of match data supplied: Values: None, Registered, Thermostats, User, ManagementSet. 
		/// </summary>
		[JsonIgnore()]
		public SelectionType SelectionType { get; set; }

		/// <summary>
		/// Gets the System.String representation of the SelectionType value.
		/// </summary>
		[JsonProperty(PropertyName = "selectionType", Required = Required.Always)]
		public string SelectionTypeString
		{
			get
			{
				// ***
				// *** Convert the string version of the enum value
				// *** to Camel Case
				// ***
				string item = this.SelectionType.ToString();
				return string.Format("{0}{1}", item.Substring(0, 1).ToLower(), item.Substring(1, item.Length - 1));
			}
		}

		/// <summary>
		/// Required. The match data based on selectionType (e.g. a list of thermostat identifiers in the case 
		/// of a selectionType of thermostats) 
		/// </summary>
		[JsonProperty(PropertyName = "selectionMatch", Required = Required.AllowNull)]
		public string SelectionMatch { get; set; }

		/// <summary>
		/// Include the thermostat runtime object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeRuntime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeRuntime { get; set; }

		/// <summary>
		/// Include the extended thermostat runtime object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeExtendedRuntime", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeExtendedRuntime { get; set; }

		/// <summary>
		/// Include the electricity readings object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeElectricity", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeElectricity { get; set; }

		/// <summary>
		/// Include the thermostat settings object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeSettings", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeSettings { get; set; }

		/// <summary>
		/// Include the thermostat location object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeLocation", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeLocation { get; set; }

		/// <summary>
		/// Include the thermostat program object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeProgram", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeProgram { get; set; }

		/// <summary>
		/// Include the thermostat calendar events objects. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeEvents", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeEvents { get; set; }

		/// <summary>
		/// Include the thermostat device configuration objects. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeDevice", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeDevice { get; set; }

		/// <summary>
		/// Include the thermostat technician object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeTechnician", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeTechnician { get; set; }

		/// <summary>
		/// Include the thermostat utility company object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeUtility", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeUtility { get; set; }

		/// <summary>
		/// Include the thermostat management company object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeManagement", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeManagement { get; set; }

		/// <summary>
		/// Include the thermostat's unacknowledged alert objects. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeAlerts", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeAlerts { get; set; }

		/// <summary>
		/// Include the current thermostat weather forecast object. If not specified, defaults to false.
		/// </summary>
		[JsonProperty(PropertyName = "includeWeather", DefaultValueHandling = DefaultValueHandling.Ignore)]
		public bool IncludeWeather { get; set; }
	}
}
